/*
 * A <code>Exit</code> is correponding a exit in the translated code.  
 */
#ifndef EXIT_H
#define EXIT_H

#include "crossbit/common.h"

namespace crossbit
{
        class VInst;
        class TBlock;
		struct ExitReason {
				enum {
						HEAD = 0,
						ENDOFBLOCK,
						BRANCHTAKEN,
						SYSCALLEXIT,
				};
		};
         
		struct LinkType {
				enum {
						DIRECT = 0 ,
						INDIRECT,
						NOLINK,
				};
		};	

		struct Exit{
                // the unique index of the <code>Exit</code> 
                XTUint32    exit_number;
                // the exit reason
				XTInt32		why;
                // the entry (spc) of the next block that should be executed. 
				XTMemAddr	next;		
				XTInt32		exitOffset;	
                // the VInst triggering the exit, NULL if
				VInst		*inst;		
				// non-relavant to any VInst
				//added by zhengjuyu
                // if the block is lined, also used to count the compare-branch pair insert for indirect branch
				XTInt32 linked;
                // the location of the linking place in the translated code 
				XTInt8 *linkCode;
				XTInt8 *linkCall;
				XTMemAddr dest;		//direct trace link to
				XTInt32  link_type;
                // the <code>TBlock</code> it belongs to
                TBlock*  tblock_pointer;
		};
}

#endif
